package drawing.demo;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;

public class ImageEffectActivity extends Activity {
	
	private ImageView imageView01;
	private ImageView imageView02;  
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 setContentView(R.layout.image_effect);
		setupViews();
	}


    //实现图片的圆角，倒影，转换
    private void setupViews(){    
        imageView01 = (ImageView)findViewById(R.id.image01);    
        imageView02 = (ImageView)findViewById(R.id.image02);    
            
        //获取壁纸返回值是Drawable    
        Drawable drawable = getWallpaper();    
        //将Drawable转化为Bitmap    
        Bitmap bitmap = ImageUtil.drawableToBitmap(drawable);    
        //缩放图片    
        Bitmap zoomBitmap = ImageUtil.zoomBitmap(bitmap, 100, 100);    
        //获取圆角图片    
        Bitmap roundBitmap = ImageUtil.getRoundedCornerBitmap(zoomBitmap, 10.0f);    
        //获取倒影图片    
        Bitmap reflectBitmap = ImageUtil.createReflectionImageWithOrigin(zoomBitmap);    
        //这里可以让Bitmap再转化为Drawable    
        //Drawable roundDrawable = new BitmapDrawable(roundBitmap);           
        //Drawable reflectDrawable = new BitmapDrawable(reflectBitmap);           
        //mImageView01.setBackgroundDrawable(roundDrawable);    
        //mImageView02.setBackgroundDrawable(reflectDrawable);    
                    
        imageView01.setImageBitmap(roundBitmap);    
        imageView02.setImageBitmap(reflectBitmap);    
    }    
    
}
